<?php
/*
 * @Descripttion: 
 * @version: 1.0
 * @Author: Sam
 * date: 2021-12-04 11:45:41
 * @LastEditors: Sam
 * @LastEditTime: 2022-01-20 18:45:54
 */
namespace app\__MODULE__\controller;

class Setting extends Base
{


    public function index(){
        /*配置列表*/
		$group_list = [
            'site_info'    => '基础信息'
        ];	
        $inc_type =  input('param.inc_type','site_info');
        $config   =  freshCache($inc_type);
        $this->assign('group_list',$group_list);
        $this->assign('inc_type',$inc_type);
        $this->assign('config',$config);//当前配置项
        return $this->fetch($inc_type);

    }

        /**
     * @name: 设置提交
     * @Author: Sam
     * date: 2020-08-31 14:13:01
     * @msg: 
     * @param {type} 
     * @return {type} 
     */
    public function set_handle(){
        $data     = input('post.');
        $inc_type = $data['inc_type'];
        if($inc_type == 'site_info'){
            $data['thumb'] = isset($data['thumb'])? $data['thumb'] :'';
        }
        if($inc_type == 'other'){
            $data['rule'] = implode(',',$data['rule']);
            $data['strategy'] = implode(',',$data['strategy']);
        }
        unset($data['inc_type']);
        freshCache($inc_type,$data);
        return json_response(1,'操作成功!');
    }
    
}